﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MMOEng.Packets.EnginePackets;
using MMOEng.SubSystems;

namespace MMOEng.Components
{
    [Serializable]
    public class RenderComponent : BaseComponent
    {
        private string _name;
        public string Name { get { return _name; } set { if (_name != value) { _name = value; NotifyOfUpdate(); } } }
        public RenderComponent(guid guid, ISubSystem parent) : base(guid, parent) { }

        public override void NotifyOfUpdate()
        {
            DeltaUpdateP p = new DeltaUpdateP(this.guid, typeof(RenderComponent), this);
            ParentSystem.PostUpdate(p);
        }

        public void UpdateComponent(RenderComponent a, RenderComponent b)
        {
            if (a.Name != b.Name) a.Name = b.Name;
        }
    }
}
